package com.weixing.mall.provider.api.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.weixing.mall.base.orm.MPage;
import com.weixing.mall.base.wrapper.Result;
import com.weixing.mall.provider.api.fallback.SysUserServiceFallback;
import com.weixing.mall.provider.api.model.dto.LoginLogDto;
import com.weixing.mall.provider.api.model.dto.UserDto;
import com.weixing.mall.provider.api.model.dto.UserUpdateDto;
import com.weixing.mall.provider.api.model.vo.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.ribbon.FeignRibbonClientAutoConfiguration;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @Author wx
 * @Date 2019/12/13 10:26
 * @Version 1.0
 */
@FeignClient(value = "mall-provider-cms", configuration = FeignRibbonClientAutoConfiguration.class, fallback = SysUserServiceFallback.class)
public interface SysUserRpcService {
    @GetMapping("/api/user/getRoleById")
    Result<List<RoleVo>> getRoleById(@RequestParam(value = "id", required = false) Long id);

    @GetMapping("/api/user/getUserListBydeptId")
    Result<List<SysUserAuthVo>> getUserListBydeptId(@RequestParam(value = "id", required = false) Long id);

    @GetMapping("/api/user/loadUserByUserName")
    Result<SysUserAuthVo> loadUserByUserName(@RequestParam(value = "userName") String userName);

    @GetMapping("/api/user/userInfo")
    Result<UserInfoVo> userInfo(@RequestParam(value = "id") Long id);

    @GetMapping("/api/user/loadUserByMobile")
    Result<SysUserAuthVo> loadUserByMobile(@RequestParam(value = "mobile") String mobile);

    @PostMapping(value = "/api/user/updateUser", consumes = "application/json")
    Result updateUser(@RequestBody UserUpdateDto sysUser);

    @PostMapping(value = "/api/user/saveLoginLog", consumes = "application/json")
    Result saveLoginLog(@RequestBody LoginLogDto sysLoginLog);

    @GetMapping(value = "/api/user/loadKefu")
    Result<List<KefuVo>> loadKefu();

    @GetMapping(value = "/api/user/getById")
    Result<SysUserVo> getById(@RequestParam(value = "id") Long id);

    @GetMapping(value = "/api/user/loadKefuById")
    Result<KefuVo> loadKefuById(@RequestParam(value = "id") Long id);

    @PostMapping(value = "/api/user/createUser")
    Result<SysUserVo> createUser(@RequestBody UserDto userDto);


    @PostMapping(value = "/api/user/selectByLoginName")
    Result<SysUserVo> selectByLoginName(@RequestParam(value = "loginName") String loginName);

    @GetMapping(value = "/api/user/selectKefuList")
    Result<MPage<KefuVo>> selectKefuList(@RequestParam(value = "currentPage") long currentPage,
                                         @RequestParam(value = "pageSize") long pageSize);

    @GetMapping(value = "/api/user/loadKefuByUserName")
    Result<KefuVo> loadKefuByUserName(@RequestParam(value = "loginName") String loginName);

    @GetMapping(value = "/api/user/checkBind")
    Result checkBind(@RequestParam(value = "customerId") Long  customerId,@RequestParam(value = "appDepotId") Long  appDepotId);

}
